package thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread lin = new  Thread("徐晨曦"){
            public void run() {
                System.out.println(getName()+"刷完抖音:睡一会儿吧~");
                try {
                    Thread.sleep(500000000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+":干什么呀，周末不睡觉起这么早");
                }
                System.out.println(getName()+"醒了");
            }
        };
        Thread huang = new Thread("陈樊凯"){
          public void run(){
              System.out.println(getName()+":开始上分!");
              for (int i = 0; i < 5; i++) {
                  System.out.println(getName()+":救命！");
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
              }
              System.out.println("defeated");
              System.out.println(getName()+":什么煞笔队友");
              lin.interrupt();
          }
        };


        lin.start();
        huang.start();
    }
}
